/*
 * Copyright (c) 2011 Vasile Vilvoiu. All rights reserved.
 *   
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * thread.h - abstraction layer for thread management routines
 */
#pragma once

#if defined _WIN32 || defined _WIN64

#define WIN32_LEAN_AND_MEAN
#define VS_EXTRALEAN

#include <windows.h>

typedef unsigned long THREAD_ENTRY_RETURN;
typedef void* THREAD_ENTRY_PARAM;
typedef HANDLE THREAD_HANDLE;

#endif

#ifdef __linux__
#error not implemented yet

typedef void* THREAD_ENTRY_RETURN;
typedef void* THREAD_ENTRY_PARAM;
#endif

typedef THREAD_ENTRY_RETURN (*THREAD_ENTRY)(THREAD_ENTRY_PARAM);

extern int thread_create(THREAD_ENTRY entry, THREAD_ENTRY_PARAM param, THREAD_HANDLE *handle);
extern void thread_yield();